home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1997 September
/
Macworld (1997-09).dmg
/
Serious Software
/
Cherwell Scientific Demos
/
pro Fit
/
pro Fit 5.0 demo (fpu).sea
/
pro Fit 5.0 demo (fpu)
/
Functions & Programs
/
•Gadgets
/
drawing macros
/
spring
< prev
next >
Wrap
Text File
|
1996-06-01
|
1KB
|
50 lines
{
This program draws a spring-like symbol at the last clicked
point in the drawing window.
This program does not bring up any dialog box. The dimensions of the
"spring" and its orientation are set in the procedure initialize, below.
To use the program, hit cmd-L (or click the Add button), look at its
keyboard equivalent in the Misc menu, clik in the drawing window,
and run the program. Then click somewhere else and run the program again.
}
program drawSpring;
var ang,h,v, Len,width,periodLength:real;
i,numPeriods:integer;
procedure initialize;
begin
Len:=10; { the length of the two lines at the beginning and end of the "spring" }
width:=10; { the lateral width }
periodLength:=5; { the repetition length }
ang:=30; { the orientation of the "spring" in degrees }
numPeriods:=7; { how many times the basic element is repeated }
ang:=ang*pi/180; { move to radians}
end;
procedure l(x,y:real);
{ performs a rotation of the coordinates and issues a "line" command }
begin
line(cos(ang)*x+sin(ang)*y,-sin(ang)*x + cos(ang)*y);
end;
begin
GetClickedCoord(h,v);
openpoly(0,0);
moveto(h,v);
l(Len,0);
l(periodLength/2,-width/2);
for i:=1 to numPeriods do
begin
l(periodLength,width);
l(periodLength,-width);
end;
l(periodLength,width);
l(periodLength/2,-width/2);
l(Len,0);
closepoly;
end;